package proxy;

import java.lang.reflect.Proxy;

/**
 * @author Han
 */
public class JavaProxyTest {
	public static void main(String[] args) throws Exception {
		HelloWorld helloWorld=new HelloWorldImpl();
		helloWorld.sayHello();
		HelloWorld h = (HelloWorld) Proxy.newProxyInstance(helloWorld.getClass().getClassLoader(), helloWorld.getClass().getInterfaces(), new HelloWorldHandler(helloWorld));
		h.sayHello();

		Proxy proxy = (Proxy) h;
		System.out.println(((Proxy) h).getInvocationHandler(h));

		System.out.println(JavaProxyTest.class.getSimpleName());
	}
	
}
